    var xmlHttp;
    function showResults(searchForm){
        var category = searchForm.category.value;
        var withinCode = searchForm.code.value;
        var title = searchForm.title.value;
		var page = searchForm.page.value;
        
        var params = "category=" + category + "&withinCode=" + withinCode + "&title=" + title + "&page=" + page;
        
        xmlHttp = new XMLHttpRequest();
	    xmlHttp.open("GET", "../search?" + params, false);
		xmlHttp.send(null);
       	xmlHttp.onreadystatechange = updateResDiv();               	
    }
    function newSearch(searchForm){
    	searchForm.page.value = 1;
		var resDiv = document.getElementById("results");
		resDiv.innerHTML = "";
    	showResults(searchForm); 
    }
    function getNext(){
        var searchForm = document.getElementById("searchForm");
        var currValue = parseInt(searchForm.page.value);
        searchForm.page.value = currValue + 1;

        showResults(searchForm); 
    }
    function getPrev(){
        var searchForm = document.getElementById("searchForm");
        var currValue = parseInt(searchForm.page.value);
        searchForm.page.value = currValue - 1;

        showResults(searchForm); 
    }
	function showItem(title){
		xmlHttp = new XMLHttpRequest();
	    xmlHttp.open("GET", "../xslt?title=" + title + "&xslId=1", false);
		xmlHttp.send(null);
       	xmlHttp.onreadystatechange = updateResDiv();               	
	}
	function showSearchResult(scid){
		xmlHttp = new XMLHttpRequest();
	    xmlHttp.open("GET", "showSearchDocument.jsp?cid=" + scid, false);
		xmlHttp.send(null);
       	xmlHttp.onreadystatechange = updateResDiv();
	}
	function showSearchItem(cid, version){
		xmlHttp = new XMLHttpRequest();
	    xmlHttp.open("GET", "edv.jsp?link=search&cid=" + cid + "&version=" + version, false);
		xmlHttp.send(null);
       	xmlHttp.onreadystatechange = updateResDiv();
	}
		 
	function updateResDiv(){
		var resDiv = document.getElementById("results");
		if (xmlHttp.readyState == 4){
			resDiv.innerHTML = xmlHttp.responseText;
		}
		else{
			resDiv.innerHTML = "<p>Loading...</p>";
		}
	}